package com.chevip.article.sync;

import lombok.Getter;

import java.util.Objects;

public class Constant {
    @Getter
    public enum ArticleType {
        /**
         * 文章类型
         */
//        SHOP_GUIDE("1"),
//
//        TOOL_BOX("2"),

        CAR_NEWS("3"),

//        MARKET("4"),

        NOTICE("5")

//        BID_NOTICE("6")
        ;

        private String type;

        ArticleType(String type) {
            this.type = type;
        }

        public static ArticleType get(String type) {
            for (ArticleType value : ArticleType.values()) {
                if (Objects.equals(type, value.getType())) {
                    return value;
                }
            }
            return null;
        }
    }

    @Getter
    public enum ArticleState {
        /**
         * 文章状态
         */
        DISCARD("9", -1),

        DRAFT("0", 0),

        CANCEL("2", 40),

        PASS("1", 30);

        private String oldValue;
        private Integer newValue;

        ArticleState(String oldValue, Integer newValue) {
            this.oldValue = oldValue;
            this.newValue = newValue;
        }

        public static ArticleState get(String oldValue) {
            for (ArticleState value : ArticleState.values()) {
                if (Objects.equals(value.getOldValue(), oldValue)) {
                    return value;
                }
            }
            return null;
        }
    }
}
